<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>表格效果</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    table {
      margin: 120px auto;
      text-align: center;
    }

    table td {
      width: 60px;
    }

    div {
      margin: 20px;
      font-size: 24px;
    }
  </style>
</head>

<body>
  <table border="1">
    <tr>
      <td>1-1</td>
      <td>2-1</td>
      <td>3-1</td>
      <td>4-1</td>
    </tr>
    <tr>
      <td>1-2</td>
      <td>2-2</td>
      <td>3-2</td>
      <td>4-2</td>
    </tr>
    <tr>
      <td>1-3</td>
      <td>2-3</td>
      <td>3-3</td>
      <td>4-3</td>
    </tr>
    <tr>
      <td>1-4</td>
      <td>2-4</td>
      <td>3-4</td>
      <td>4-4</td>
    </tr>
  </table>
  <div>
    <a href="./倒计时.html">跳转至倒计时页面</a>
  </div>
  <script>
    // 获取table元素
    var tableEl = document.body.firstElementChild;

    // 获取每一行
    var trELs = tableEl.rows;
    console.log(trELs);
    for (var i = 0; i < trELs.length; i++) {
      trELs[i].cells[i].style.backgroundColor = "red";
    }

  </script>
</body>

</html>